<?php
class MyuserAction extends AdminAction {

	#列表
	function index() {
		$wxid = I('get.wxid');
		if ($wxid=='' || empty($wxid)) {
			$this->error('参数错误');
		}

		$obj = M('Member');
		$map['wxid'] = $wxid;

		$wxname = $obj->where($map)->getField('wxname');
		$this->assign('wxname',$wxname);

		unset($map);
		$map['fid'] = $wxid;
		$map['wxid'] = array('neq','');
		$map['guanzhu'] = 1;
		$list = $obj->field('id,wxid,wxname,userGroup')->where($map)->select();

		foreach ($list as $key => $value) {
			unset($map);
			$map['fid'] = $value['wxid'];
			$map['wxid'] = array('neq','');
			$map['guanzhu'] = 1;
			$list[$key]['child'] = $obj->field('id,wxid,wxname,userGroup')->where($map)->select();

			foreach ($list[$key]['child'] as $j => $val) {
				unset($map);
				$map['fid'] = $val['wxid'];
				$map['wxid'] = array('neq','');
				$map['guanzhu'] = 1;
				$list[$key]['child'][$j]['childest'] = $obj->field('id,wxid,wxname,userGroup')->where($map)->select();
			}
		}

		$this->assign('list',$list);
		$this->display();
	}

}
?>